<template>
  <div class="simple-container">
    <div class="debug-banner">
      ✅ SmartEvaluation 简化版本 - {{ currentTime }}
    </div>
    
    <div class="page-header">
      <button class="back-btn" @click="goBack">← 返回</button>
      <h1 class="page-title">智能评估</h1>
    </div>

    <div class="content">
      <div class="problem-section">
        <h2>您的问题描述</h2>
        <div class="problem-card">
          <p>{{ problemText || '暂无问题描述' }}</p>
          <button @click="supplementQuestion">补充问题</button>
        </div>
      </div>

      <div class="risk-section">
        <h2>风险评估</h2>
        <div class="risk-card">
          <div class="risk-level">⚠️ 中等风险</div>
          <p>建议通过调解或仲裁解决，避免直接诉讼</p>
        </div>
      </div>

      <div class="solutions-section">
        <h2>推荐解决方案</h2>
        <div class="solution-list">
          <div 
            v-for="(solution, index) in solutions" 
            :key="index"
            class="solution-card"
            :class="{ active: selectedSolution === index }"
            @click="selectSolution(index)"
          >
            <h3>{{ solution.title }}</h3>
            <p>{{ solution.description }}</p>
            <div class="solution-stats">
              <span>耗时: {{ solution.duration }}</span>
              <span>费用: {{ solution.cost }}</span>
              <span>成功率: {{ solution.successRate }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SmartEvaluationSimple',
  data() {
    return {
      currentTime: new Date().toLocaleString(),
      problemText: '公司拖欠工资3个月，要求支付工资和经济补偿金',
      selectedSolution: null,
      solutions: [
        {
          title: '劳动仲裁',
          description: '通过劳动仲裁委员会解决争议，程序相对简单，成本较低',
          duration: '15-30天',
          cost: '¥0-500',
          successRate: '85%'
        },
        {
          title: '法院诉讼',
          description: '直接向法院起诉，程序复杂但具有强制执行力',
          duration: '3-6个月',
          cost: '¥1000-5000',
          successRate: '70%'
        },
        {
          title: '协商调解',
          description: '通过律师或调解员协助协商，快速解决争议',
          duration: '3-7天',
          cost: '¥200-1000',
          successRate: '90%'
        }
      ]
    }
  },
  mounted() {
    console.log('🎯 SmartEvaluation 简化版本加载成功')
    
    // 更新时间
    setInterval(() => {
      this.currentTime = new Date().toLocaleString()
    }, 1000)
    
    // 从本地存储获取问题描述
    try {
      const storedProblemText = localStorage.getItem('problemText')
      if (storedProblemText) {
        this.problemText = storedProblemText
        console.log('✅ 获取到问题描述:', storedProblemText)
      }
    } catch (e) {
      console.error('❌ 获取本地存储失败:', e)
    }
  },
  methods: {
    goBack() {
      if (this.$router) {
        this.$router.push('/')
      } else {
        window.history.back()
      }
    },
    selectSolution(index) {
      this.selectedSolution = index
      console.log('选择方案:', this.solutions[index].title)
    },
    supplementQuestion() {
      const additional = prompt('请输入补充内容:')
      if (additional) {
        this.problemText += '\n\n补充说明：' + additional
        console.log('补充问题:', additional)
      }
    }
  }
}
</script>

<style scoped>
.simple-container {
  min-height: 100vh;
  background: #f5f7fa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.debug-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #28a745;
  color: white;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  z-index: 1000;
}

.page-header {
  background: #0A2463;
  color: white;
  padding: 50px 20px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.back-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: bold;
}

.content {
  padding: 20px;
}

.problem-section, .risk-section, .solutions-section {
  margin-bottom: 30px;
}

.problem-section h2, .risk-section h2, .solutions-section h2 {
  color: #333;
  font-size: 18px;
  margin-bottom: 15px;
  border-left: 4px solid #0A2463;
  padding-left: 12px;
}

.problem-card, .risk-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
}

.problem-card button {
  background: #0A2463;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
}

.risk-level {
  font-size: 16px;
  font-weight: bold;
  color: #ffc107;
  margin-bottom: 8px;
}

.solution-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.solution-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.solution-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.solution-card.active {
  border-color: #0A2463;
  box-shadow: 0 4px 16px rgba(10, 36, 99, 0.2);
}

.solution-card h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 16px;
}

.solution-card p {
  margin: 0 0 15px 0;
  color: #666;
  line-height: 1.5;
}

.solution-stats {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.solution-stats span {
  background: #f8f9fa;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .page-header {
    padding: 45px 15px 15px;
  }
  
  .content {
    padding: 15px;
  }
  
  .solution-stats {
    flex-direction: column;
    gap: 8px;
  }
}
</style>

